import React, { Component } from 'react';

import './index.scss';

export default class TableBodyCon extends Component {
  render () {
    const { crawlerConfigData, onCrawlClick } = this.props;
    return (
      <tbody>
        {
          crawlerConfigData.map((item, index) => {
            return (
              <tr
                key={ index }
                >
                <td className="td-desc">
                  操作注意：{item.description}
                </td>
                <td className="td-btn">
                  <button 
                    className={ ['btn', item.loading ? 'btn-warning' : 'btn-success'].join(' ') }
                    onClick = { ()=> onCrawlClick(item.apiName, index) }
                    > 
                    { item.loading ? '爬取中...':  item.title}
                  </button>
                </td>
              </tr>
            )
          })
        }
      </tbody>
    )
  }
}